/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package photoshare.services;

import java.sql.SQLException;
import java.util.ArrayList;
import photoshare.dao.FunctionDAO;
import photoshare.dto.FunctionDTO;

/**
 *
 * @author PhotoShare
 */
public class FunctionService {

    public FunctionService() {
    }
     public boolean create(FunctionDTO functionDTO) throws SQLException {
        return new FunctionDAO().create(functionDTO);
    }

    public ArrayList<FunctionDTO> findAll() {
        return new FunctionDAO().readAll();
    }

    public FunctionDTO readById(Integer functionId) {
        return new FunctionDAO().readById(functionId);
    }

    public boolean updateById(FunctionDTO functionDTO, Integer functionId) throws SQLException {
        return new FunctionDAO().updateById(functionDTO, functionId);
    }

    public boolean deleteById(Integer functionId) throws SQLException {
        return new FunctionDAO().deleteById(functionId);
    }

    public ArrayList<FunctionDTO> findByRole(Integer roleId) {
        return new FunctionDAO().readByRole(roleId);
    }

}
